export default app => {
  const { STRING, INTEGER, DATE } = app.Sequelize;

  const MainBusiness = app.model.define('MainBusiness', {
    id: { type: INTEGER, primaryKey: true, autoIncrement: true },
    uuid: { type: STRING(36), unique: true },
    name: STRING(10),
    createdAt: DATE,
    updatedAt: DATE,
  }, {
    tableName: 'main_business'
  });

  MainBusiness.associate = () => {
    app.model.MainBusiness.belongsToMany(app.model.Company, {
      through: app.model.MergeCompanyMainbusiness,
      foreignKey: 'fk_mainBusiness_id',
      targetKey: 'id',
    });
  };
  return MainBusiness;
};
